﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EShop.Models;

namespace EShop.Controllers
{
    public class ShopController : Controller
    {
        EShopEntities shopDB = new EShopEntities();
        //
        // GET: /Shop/
        public ActionResult Index()
        {
            var genres = shopDB.Genres.ToList();

            return this.View(genres);
        }

        //
        // GET: /Store/Browse?genre=?Disco
        public ActionResult Browse(string genre)
        {
            var genreModel = shopDB.Genres.Include("Goods").Single(g => g.Name == genre);
            return View(genreModel);
        }

        //
        // GET: /Store/Details/5
        public ActionResult Details(int id)
        {
            var goods = shopDB.Goods.Find(id);
            return View(goods);
        }

        //
        // GET: /Store/GenreMenu

        [ChildActionOnly]
        public ActionResult GenreMenu()
        {
            var genres = shopDB.Genres.ToList();

            return PartialView(genres);
        }

    }
}
